<?php
###############   COPYLEFT GPLv3 LICENSE   ###############
##
## JFX Version 0.2.9
## Website Management Software
## www.jfxcms.com
##
## Copyright 2009 GPLv3 - http://www.opensource.org/licenses/gpl-3.0.html
##
## Anthony Gallon
## oi_antz@hotmail.com
##
## Permission is hereby granted to any person having a copy of this software
## to freely use and modify as required so long as the copyright notices
## and branding remain intact.
##
## Full license details available at http://www.jfxcms.com/license
##
###############   COPYLEFT GPLv3 LICENSE   ###############



if(!$USER->checkAdminPermission('core', 'perm_create_templates') &&
    !$USER->checkAdminPermission('core', 'perm_edit_templates') &&
    !$USER->checkAdminPermission('core', 'perm_manage_templates') &&
    !$USER->checkAdminPermission('core', 'perm_delete_templates')){
    
    JFX::addError($this->lang('permission_denied'));
    JFX::redirect($CONFIG->adminUrl);
}

$THEME->addBreadcrumb($this->adminUrl.'/export/', $this->lang('ap_title_export'));



$req = explode('?', $_SERVER['REQUEST_URI']);
$req = explode('/', $req[0]);
while($req[0] != trim($CONFIG->adminFolder, '/')){
    array_shift($req);
    $req = array_regenerate_keys($req);
}
array_shift($req);
array_shift($req);
$selectedTab = array_shift($req);
$selectedTab = str_replace('../', '', $selectedTab);

if(strlen(trim($selectedTab))==0){
    $selectedTab = 'list';
}


$tabs = array(
    array(
	'label' => 'new',
	'title' => $this->lang('new_template_tab'),
	'selected' => ($selectedTab == 'new'),
	'url' => $CONFIG->adminUrl.'/templates/new/'
    ),
    array(
	'label' => 'list',
	'title' => $this->lang('list_template_tab'),
	'selected' => ($selectedTab == 'list'),
	'url' => $CONFIG->adminUrl . '/templates/list/'
    )/* ,
	  array(
	  'label' => 'publish',
	  'title' => $this->lang('publish_tab'),
	  'selected' => ($selectedTab=='publish'),
	  'url' => $this->adminUrl.'/publish/'
	  ) */
);


if($selectedTab!='edit'){
	$SMARTY->assign('tabs', $tabs);
	echo $SMARTY->fetch($CONFIG->templatesDir.'/admin/tabs.tpl');
	echo '<div id="admin-content">';
}
if (trim($selectedTab) != '' && file_exists($CONFIG->adminActionsDir.'/templates/'.$selectedTab.'.php')) {
	require($CONFIG->adminActionsDir.'/templates/'.$selectedTab.'.php');
}
if($selectedTab!='edit'){
echo '</div>';
}










